Standard
To integrate ticket issuance into your platform, the first step is to make a call to the menta API each time tickets are issued. This can occur in various scenarios, such as at the time of purchase, when sending comp tickets to end users, or any other instance where tickets are generated.
Tickets can be issued either individually or in bulk, for example, when a user purchases multiple tickets simultaneously.
To report ticket issuance, use the /v1/tickets
endpoint. This endpoint expects an array of tickets. If you need to send information about a single ticket, simply send an array containing that single item.
- cURL
- Python
- Java
curl -X POST 'https://api.mentatickets.com/v1/tickets'
-H 'Authorization: YOUR_API_KEY'
-H 'Content-Type: application/json'
--data-raw '[
{
"ticketOptionId": "0001",
"showId": "4726",
"externalReferenceEventId": "the-lion-king-broadway",
"buyer": "buyer@emaildomain.com",
"ticketId": "111",
"ticketAccess": {
"type": "URL",
"locator": "https://storage.googleapis.com/default_mentatickets-core/Captura%20de%20pantalla%202023-03-21%20a%20la(s)%2010.46.42.png",
"status": "LOCKED"
}
}
]'
import requests
import json
url = "https://api.mentatickets.com/v1/tickets"
headers = {
"Authorization": "YOUR_API_KEY",
"Content-Type": "application/json",
}
ticketOptionId = "0001"
showId = "4726"
externalReferenceEventId = "the-lion-king-broadway"
buyer = "buyer@emaildomain.com"
ticketId = "111"
ticketAccessType = "URL"
locator = "https://storage.googleapis.com/default_mentatickets-core/Captura%20de%20pantalla%202023-03-21%20a%20la(s)%2010.46.42.png"
status = "LOCKED"
data = [
{
"ticketOptionId": ticketOptionId,
"showId": showId,
"externalReferenceEventId": externalReferenceEventId,
"buyer": buyer,
"ticketId": ticketId,
"ticketAccess": {
"type": ticketAccessType,
"locator": locator,
"status": status,
},
}
]
response = requests.post(url, headers=headers, data=json.dumps(data))
OkHttpClient client = new OkHttpClient(); MediaType JSON = MediaType.get("application/json; charset=utf-8");
String ticketOptionId = "0001"; String showId = "4726"; String externalReferenceEventId = "the-lion-king-broadway"; String buyer = "buyer@emaildomain.com"; String ticketId = "111"; String ticketAccessType = "URL"; String locator = "https://storage.googleapis.com/default_mentatickets-core/Captura%20de%20pantalla%202023-03-21%20a%20la(s)%2010.46.42.png"; String status = "LOCKED";
String json = String.format(""" [ { "ticketOptionId": "%s", "showId": "%s", "externalReferenceEventId": "%s", "buyer": "%s", "ticketId": "%s", "ticketAccess": { "type": "%s", "locator": "%s", "status": "%s" } } ] """, ticketOptionId, showId, externalReferenceEventId, buyer, ticketId, ticketAccessType, locator, status);
RequestBody body = RequestBody.create(JSON, json); Request request = new Request.Builder() .url("https://api.mentatickets.com/v1/tickets") .post(body) .addHeader("Authorization", "YOUR_API_KEY") .addHeader("Content-Type", "application/json") .build();
try (Response response = client.newCall(request).execute()) { System.out.println(response.body().string()); } catch (IOException e) { e.printStackTrace(); }
</TabItem>
<TabItem value="php" label="PHP">
Here is an example of how to notify menta of the emission of a ticket, with fictitious data, using PHP.
```php {3}
<?php
$url = "https://api.mentatickets.com/v1/tickets";
$headers = array(
"Authorization: YOUR_API_KEY",
"Content-Type: application/json",
);
$data = array(
array(
"ticketOptionId" => "0001",
"showId" => "4726",
"externalReferenceEventId" => "the-lion-king-broadway",
"buyer" => "buyer@emaildomain.com",
"ticketId" => "111",
"ticketAccess" => array(
"type" => "URL",
"locator" => "https://storage.googleapis.com/default_mentatickets-core/Captura%20de%20pantalla%202023-03-21%20a%20la(s)%2010.46.42.png",
"status" => "LOCKED"
)
)
);
$json_data = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
What Ticket Information Does menta Need to Function?
Below are the fields that make up a ticket. It is important to note that all fields are mandatory:
Ticket
Entity
Field | Data Type | Description | Example |
---|---|---|---|
ticketOptionId | String | ID of the ticket type you use on your platform. | "0001" |
showId | String | ID of the Event Show (if more than one) used on your platform. | "4726" |
externalReferenceEventId | String | ID of the Event used on your platform. | "the-lion-king-broadway" |
buyer | String | Email address of the original ticket buyer. | "buyer@emaildomain.com" |
ticketId | String | ID of the Ticket. Must be unique across your platform. | "111" |
ticketAccess | TicketAccess | Information about the ticket access locator. | See the table below |
TicketAccess
Entity
Field | Data Type | Description | Example |
---|---|---|---|
type | Enum (URL or API) | Specifies the type of resource to obtain the ticket QR. | "URL" |
locator | String | URL of the resource where the Ticket QR is located. | "https://platform.com/images/qr-123.png" |
If you need further assistance or have any questions about the removal process, please do not hesitate to contact us.